const fs = require("fs");
const path = require("path");

let oldPath = path.join(__dirname, "renametest.txt");

let newPath = path.join(__dirname, "dir/new.txt");

//异步
fs.rename(oldPath, newPath, (err) => {
    if (err) {
        console.log(err);
    }
})

//更改路径 删除原来的文件 